﻿/*
 * Copyright © 2020, Wuxi Safover Intelligent Technology Co., Ltd. All rights reserved.
 * 
 * 无锡安永智能科技有限公司版权所有，未经许可，不得用于商业用途
 * 
 * Visit: https://www.safover.com/ 
 */

using System;
using Safover.LidarCollector.Extensions;

namespace Om.Default
{
    internal class DriverBoardPacket : NJOpticalMaserPacket
    {
        public override PacketType PacketType => PacketType.DriverBoard;

        public float ElectricitySetValue => BitConverter.ToUInt16(new byte[] { RawBytes[5], RawBytes[4] }, 0) / 100f;

        public float ElectricityRealValue => BitConverter.ToUInt16(new byte[] { RawBytes[7], RawBytes[6] }, 0) / 100f;

        public float LdPressureDrop => BitConverter.ToUInt16(new byte[] { RawBytes[13], RawBytes[12] }, 0) / 100f; 

        
        public float LdPWM => BitConverter.ToUInt16(new byte[] { RawBytes[22], RawBytes[21] }, 0) / 100f; 

        public bool IsElectricityNormal => !RawBytes[36].IsBitSet(0);

        public bool IsVoltageNormal => !RawBytes[36].IsBitSet(1);

        public DriverBoardPacket(byte[] rawBytes) : base(rawBytes)
        { }
    }

    

}
